﻿using System;
using System.Text;

/* 
 * Write a program that reads a string, reverses it and prints the result at the console.
 * Example: "sample" -> "elpmas".
 */

namespace ReverseString
{
    class ReverseString
    {
        static string StringReverse(string text)
        {
            StringBuilder reversed = new StringBuilder(text.Length);
            for (int index = text.Length - 1; index >= 0; index--)
            {
                reversed.Append(text[index]);
            }
            return reversed.ToString();
        }

        static void Main()
        {
            Console.Write("Enter a string: ");
            string str = Console.ReadLine();
            Console.WriteLine(StringReverse(str));
        }
    }
}
